1) Field of the Invention
The present invention relates to a process and an apparatus for optimizing a program which includes a plurality of callable program parts, and is written in an interpretive language.
2) Description of the Related Art
The programming languages can be broadly divided into compiler languages and interpretive languages. When a source program is written in a compiler language, the CPU first translates the whole source program into a machine-interpretable representation, before executing the program. On the other hand, when a source program is written in an interpretive language, the CPU sequentially interprets respective portions of the source program during execution of the program.
Since the whole source program is translated into a machine-interpretable representation before executing the program, the execution rates of programs written in compiler languages are higher than those written in interpretive language.
On the other hand, when a source program is written in an interpretive language, it is unnecessary to translate the whole source program into a machine-interpretable representation before executing the program, and therefore processing performed by the CPU becomes simple.
However, when a source program is written in an interpretive language, the execution rates of the program is low since overhead during the execution is great.
Conventionally, various methods have been proposed for optimizing the program and increasing the execution rates of the program. However, according to the conventional methods, the whole program is uniformly optimized at a certain optimization level. That is, the optimization is performed on even a portion of the program which is rarely executed, at the same optimization level as a portion of the program which is frequently executed. Therefore, the conventional optimization is not efficient.
In addition, although the execution rate of the program increases with the degree (level) of the optimization, the time needed for optimization processing per se also increases with the degree of the optimization. Therefore, it is difficult to determine an appropriate optimization level.